<?php
namespace Home\Common;

class User extends Mysql{
	function __construct(){
		parent::__construct();
	}
	function valiUser($username,$password){
		$result=$this->mysql->prepare("select * from mog_members where username='$username' and password='$password'");
		$result->execute();
		$row=$result->fetch(\PDO::FETCH_ASSOC);
		if($row==NULL) return false;
		else{
			session('username',$row['username']);
			session('password',$row['password']);
			return true;
		}
	}
	function rePassword($password){
		$username = session('username');
		$result = $this->mysql->prepare("update mog_members set password = \"$password\" where username = \"$username\"");
		$status = $result->execute();
		if(!status){
			return false;
		}else{
			return true;
		}
	}
}
